package com.dead.controller;

import com.dead.config.DeadConfig;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class SendMessageController {
    @Autowired
    public RabbitTemplate rabbitTemplate;
    @RequestMapping("/send")
    public String send(){
        rabbitTemplate.convertAndSend(DeadConfig.REJECT_EXCHANGE_NAME,DeadConfig.REJECT_ROUTE_KEY,"reject dead msg");
        rabbitTemplate.convertAndSend(DeadConfig.TTL_EXCHANGE_NAME,DeadConfig.TTL_ROUTE_KEY,"ttl dead msg");
        rabbitTemplate.convertAndSend(DeadConfig.OVER_EXCHANGE_NAME,DeadConfig.OVER_ROUTE_KEY,"over dead msg");

        return "success";
    }
}
